package park;

import java.util.Scanner;

public class J05Ex35Charges {
	
	public static void main(String [] args){
		
		//잔돈 계산하는 프로그램
		
		//변수
		int pay = 0; //청구금액
		int money = 0; //지불금액		
		int charge = 0; //잔돈		
		int w50000 = 0; //지불금액		
		int w10000 = 0; //지불금액		
		int w5000 = 0; //지불금액		
		int w1000 = 0; //지불금액		
		int w500 = 0; //지불금액		
		int w100 = 0; //지불금액		
		int w50 = 0; //지불금액		
		int w10 = 0; //지불금액
		String result="";
		Scanner sc = new Scanner(System.in);
		
	
		//잔돈계산
		
		System.out.println("청구금액을 입력하세요");
		pay = sc.nextInt();
		System.out.println("지불금액을 입력하세요");
		money = sc.nextInt();
		
		charge = money - pay;
		
		//50000계산
		w50000 = charge / 50000;
		
		//10000계산
		charge = charge % 50000;
		w10000 = charge / 10000;
		
		//5000계산
		charge = charge % 10000;
		w5000  = charge / 5000;
		
		//1000계산		
		charge = charge % 5000;
		w1000  = charge / 1000;
		
		//500계산		
		charge = charge % 1000;
		w500  = charge / 500;
		
		//100계산		
		charge = charge % 500;
		w100  = charge / 100;
		
		//50계산		
		charge = charge % 100;
		w50  = charge / 50;
		

		//10계산		
		charge = charge % 50;
		w10  = charge / 10;
		

		//결과출력
		System.out.println("거스름돈은 다음과 같습니다");
		result += "50000원권 : " + w50000+"\n";
		result += "10000원권 : " + w10000+"\n";
		result += "5000원권 : " + w5000+"\n";
		result += "1000원권 : " + w1000+"\n";
		result += "500원 : " + w500+"\n";
		result += "100원 : " + w100+"\n";
		result += "50원 : " + w50+"\n";
		result += "10원 : " + w10+"\n";
		System.out.println(result);
		
	}

}
